home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UCRASM25.ARJ / CRSETS.ASM < prev    next >
Assembly Source File  |  1991-10-12  |  1KB  |  59 lines

  1. StdGrp        group    stdlib,stddata
  2. stddata        segment    para public 'sldata'
  3. stddata        ends
  4. ;
  5. stdlib        segment    para public 'slcode'
  6.         assume    cs:stdgrp
  7. ;
  8.         extrn    sl_malloc:far
  9. ;
  10. ; CreateSets-    Creates an 8-element array of sets.
  11. ;
  12. ; outputs:
  13. ;
  14. ;    es:di-    Pointer to first element.  Each successive element of the
  15. ;        array starts one byte later.
  16. ;
  17. ;    carry=0 if successful.
  18. ;    carry=1 if could not allocate sufficient memory for the set.
  19. ;
  20. ;
  21.         public    sl_CreateSets
  22. ;
  23. sl_CreateSets    proc    far
  24.         push    ax
  25.         push    cx
  26.         pushf
  27. ;
  28.         mov    cx, 256+16        ;# of bytes for a set array.
  29.         call    sl_malloc        ;Allocate storage for the set.
  30.         jc    BadAlloc
  31.         xor    ax, ax            ; Turn into the empty set.
  32.         push    di
  33.         mov    cx, (256+16)/2
  34.         cld
  35.     rep    stosw
  36.         pop    di
  37.         mov    word ptr es:[di], 201h    ;Init the mask bytes
  38.         mov    word ptr es:2[di], 804h
  39.         mov    word ptr es:4[di], 2010h
  40.         mov    word ptr es:6[di], 8040h
  41. ;
  42.         popf
  43.                 pop    cx
  44.         pop    ax
  45.         clc
  46.         ret
  47. ;
  48. BadAlloc:    pop    di
  49.         popf
  50.                 pop    cx
  51.         pop    ax
  52.         stc
  53.         ret
  54. sl_CreateSets    endp
  55. ;
  56. ;
  57. stdlib        ends
  58.         end
  59.